import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:websafe_svg/websafe_svg.dart';

Widget imageFromAsset(
  String asset, {
  Alignment alignment = Alignment.center,
  Color color,
  bool excludeFromSemantics = false,
  BoxFit fit = BoxFit.contain,
  double height,
  Key key,
  String package,
  WidgetBuilder placeholderBuilder,
  String semanticsLabel,
  double width,
  ImageFrameBuilder frameBuilder,
}) {
  return Image.asset(
    asset,
    alignment: alignment,
    color: color,
    excludeFromSemantics: excludeFromSemantics,
    fit: fit,
    height: height,
    key: key,
    package: package,
    width: width,
    frameBuilder: frameBuilder,
  );
}

Widget svgFromAsset(
  String asset, {
  Alignment alignment = Alignment.center,
  Color color,
  bool excludeFromSemantics = false,
  BoxFit fit = BoxFit.contain,
  double height,
  Key key,
  String package,
  WidgetBuilder placeholderBuilder,
  String semanticsLabel,
  double width,
  ImageFrameBuilder frameBuilder,
}) {
  return WebsafeSvg.asset(
    asset,
    alignment: alignment,
    color: color,
    fit: fit,
    height: height,
    package: package,
    width: width,
  );
}

Widget svgFromFile({
  String imageUrl,
  double width,
  double height,
  Color color,
  BoxFit fit,
  WidgetBuilder placeholderBuilder,
}) {
  return SvgPicture.file(
    File(imageUrl),
    width: width,
    height: height,
    color: color,
    fit: fit,
    placeholderBuilder: (context) {
      return placeholderBuilder(context);
    },
  );
}
